package model;

import codeGenerator.visitor.IMetaModelVisitor;

public class CompositeElement {

	private String mName = "";

	private String mType = "";

	private String mMultiplicity = "1";

	private String mPackage = "";

	private String mVisibility = "private";

	public CompositeElement(String aName) {
		this.mName = aName;
	}

	public void setMultiplicity(String aMultiplicity) {
		this.mMultiplicity = aMultiplicity;
	}

	public String getPackage() {
		return this.mPackage;
	}

	public void setPackage(String mPackage) {
		this.mPackage = mPackage;
	}

	public void accept(IMetaModelVisitor aGenerator) {
		aGenerator.visitCompositeElement(this);
	}

	public String getVisibility() {
		return this.mVisibility;
	}

	public void setVisibility(String aVisibility) {
		this.mVisibility = aVisibility;
	}

	public String getMultiplicity() {
		return this.mMultiplicity;
	}

	public String getName() {
		return mName;
	}

	public void setName(String mName) {
		this.mName = mName;
	}

	public String getType() {
		return mType;
	}

	public void setType(String mType) {
		this.mType = mType;
	}

	public boolean isMultiple() {
		return !this.getMultiplicity().equals("1");
	}

	public String getCompleteType() {
		// Récupération du package
		String completeType = this.getPackage();

		// Si un package est défini
		if (!completeType.isEmpty()) {
			// Ajout du séparateur
			completeType += ".";
		}
		// Ajout du type
		completeType += this.getType();

		// Retour du type complet
		return completeType;
	}
}
